package com.weixing.mall.core.validation.constraint;

import com.weixing.mall.base.constant.GlobalConstant;
import com.weixing.mall.core.validation.Password;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @Author: kfc
 * @Description: <br/>
 * Date:Create in 2019/8/6 17:42
 * @Modified By:
 */
public class PasswordValidation implements ConstraintValidator<Password,String> {
    @Override
    public void initialize(Password constraintAnnotation) {

    }

    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        return s.matches(GlobalConstant.REGEX_PASSWORD);
    }
}
